package com.peng.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

@Controller
public class ControllerDemo {
    @RequestMapping("t1")
    @ResponseBody
    public String interceptro(){
        return "Ok";
    }

    @RequestMapping("main")
    public String main(){
        return "main";
    }

    @RequestMapping("gologin")
    public String goLogin(){
        return "login";
    }

    @RequestMapping("login")
    public String gomain(String username, String pwd, HttpSession hs, Model model){
        System.out.println(pwd);
        model.addAttribute("username",username);
        hs.setAttribute("id",pwd);
        return "main";
    }
}
